Skip to content

fix: routes controller on node name drift#1221

Merged
lukasmetzner merged 5 commits into
mainfrom
fix/routes-controller-node-name-drift
May 19, 2026
Merged

fix: routes controller on node name drift#1221
lukasmetzner merged 5 commits into
mainfrom
fix/routes-controller-node-name-drift

Conversation

@lukasmetzner
Copy link
Copy Markdown
Contributor

@lukasmetzner lukasmetzner commented Apr 23, 2026

If a Kubernetes node got successfully initialized we have the Server ID stored in the node objets providerID. When renaming a Server, causing a drift between the node and Server name, we should still be able to identify the Server via its ID. This is currently not implemented in the routes' controller, where we rely purly on the Servers name.

As the upstream library only provides us with the Kubernetes node name and not the full object, we have to first fetch it from the Kubernetes API. With the node object at hand we can identify and fetch the Server by its ID. Furthermore, we can use the Kubernetes node object to improve our handling of Kubernetes events. The event emitted on a CIDR mismatch is currently not associated with the affected node, because so far we did not have access to the nodes UUID.

Fixes #1214

@codecov
Copy link
Copy Markdown

codecov Bot commented Apr 23, 2026

Codecov Report

❌ Patch coverage is 77.55102% with 22 lines in your changes missing coverage. Please review.
✅ Project coverage is 70.62%. Comparing base (f1e6599) to head (c1b4d40).

Files with missing lines Patch % Lines
hcloud/routes.go 72.83% 13 Missing and 9 partials ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1221      +/-   ##
==========================================
+ Coverage   69.95%   70.62%   +0.67%     
==========================================
  Files          24       24              
  Lines        2656     2676      +20     
==========================================
+ Hits         1858     1890      +32     
+ Misses        629      609      -20     
- Partials      169      177       +8     
Flag Coverage Δ
e2e 44.87% <38.77%> (-0.13%) ⬇️
unit 67.04% <75.51%> (+1.03%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@lukasmetzner lukasmetzner force-pushed the fix/routes-controller-node-name-drift branch from 0e99446 to 19d6cf7 Compare April 23, 2026 13:18
@lukasmetzner lukasmetzner force-pushed the fix/routes-controller-node-name-drift branch from 19d6cf7 to 1382b4c Compare April 27, 2026 12:01
@lukasmetzner lukasmetzner force-pushed the fix/routes-controller-node-name-drift branch from 08a2e3f to ea742f6 Compare April 27, 2026 12:48
@lukasmetzner lukasmetzner force-pushed the fix/routes-controller-node-name-drift branch from ea742f6 to eb55116 Compare May 5, 2026 13:04
@lukasmetzner lukasmetzner marked this pull request as ready for review May 5, 2026 13:13
@lukasmetzner lukasmetzner requested a review from a team as a code owner May 5, 2026 13:13
Comment thread hcloud/routes.go Outdated
If a Kubernetes node got successfully initialized we have the Server
ID stored in the node objets `providerID`. When renaming a Server,
causing a drift between the node and Server name, we should still
be able to identify the Server via its ID. This is currently not
implemented in the routes' controller, where we rely purly on the
Servers name.

As the upstream library only provides us with the Kubernetes node name
and not the full object, we have to first fetch it from the Kubernetes
API. With the node object at hand we can identify and fetch the Server
by its ID. Furthermore, we can use the Kubernetes node object to improve
our handling of Kubernetes events. The event emitted on a CIDR mismatch
is currently not associated with the affected node, because so far we
did not have access to the nodes UUID.
@lukasmetzner lukasmetzner force-pushed the fix/routes-controller-node-name-drift branch from eb55116 to 0796918 Compare May 18, 2026 14:02
@lukasmetzner lukasmetzner merged commit 18493d2 into main May 19, 2026
9 of 10 checks passed
@lukasmetzner lukasmetzner deleted the fix/routes-controller-node-name-drift branch May 19, 2026 12:29
@andsens
Copy link
Copy Markdown

andsens commented May 19, 2026

hot damn! Quite the short turnaround time on such a big change! I'm impressed and very grateful. Thank you 🙏
Looking forward to updating our server naming scheme :-D

@lukasmetzner
Copy link
Copy Markdown
Contributor Author

Took the opportunity to clean up some old code :D

lukasmetzner pushed a commit that referenced this pull request May 19, 2026
### Bug Fixes

- routes controller on node name drift (#1221)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Native routing: Renaming servers in in hcloud but not Kubernetes (which you can't) results in a bad time (TM)

3 participants